[mck] http://www.matthijskamstra.nl/blog a polymath zapper Wed, 17 Jun 2020 09:24:39 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.15 Wacom driver crashes on OSX http://www.matthijskamstra.nl/blog/2017/03/03/wacom-driver-crashes-on-osx/ Fri, 03 Mar 2017 09:37:42 +0000 http://www.matthijskamstra.nl/blog/?p=2298

Update #1: I recently run in a situation with my Wacom that everything failed. So I uninstalled everything first.

  1. Open your Application folder, and locate any of the following folders:
    • Bamboo
    • Pen Tablet
    • Tablet
    • Wacom
    • Wacom Tablet
  2. In each of these located folders will be a Wacom Utility, double-click to launch the utility
  3. Select the option to ‘Remove’ in the ‘Tablet Software’ section of the utility
    • You may be prompted to enter your system’s password at this time
  4. The utility will notify you when the removal is complete

I use a Wacom table instead of a mouse. Most designers do. That driver has a mind of its own. It crashes a lot.It’s happens when I startup Illustrator or switch workplace or when it wakes up from sleep mode or connect to an external monitor.Or just randomly.And I don’t want to restart my computer every-time it happens.So I googled the problem before I dive into the problem myself.The post describes the same problem, but the solution doesn’t work for me.So this is my solution.First the specs:

  1. Mac OS 10.12.3
  2. Wacom Bamboo model CTH-470

Make sure you have the correct driver installed… duh! In a working situation (driver is working) you can see it with “Activity monitor”, search for “PenTabletDriver”So when your Wacom is not working you won’t see it (obviously).

Now how to restart it!

Now open the Finder > Go > Go to folderAnd copy past this folder:/Library/Application Support/Tablet/It will open een folder with “PenTabletDriver.app” in it.Double click it and you Wacom will work again.

Developers Solution

In the comments of earlier mention blog, someone mentions a “Automator script”.I will be using bash: create a file named “WacomReboot.sh”#!/bin/bashecho 'Kill the PenTabletDriver (just to be sure)'killall PenTabletDriverecho 'Start the PenTabletDriver again'open -a PenTabletDriver & exitSave file in /usr/local/bin/Now restart the Wacom:Open terminal and type “WacomReboot.sh” and enter:โ†’ WacomReboot.shKill the PenTabletDriver (just to be sure)Start the PenTabletDriver againBam … back to work!

]]>
Filmpjes op de achterbank “the hard way” http://www.matthijskamstra.nl/blog/2016/07/14/filmpjes-op-de-achterbank-the-hard-way/ Thu, 14 Jul 2016 09:44:06 +0000 http://www.matthijskamstra.nl/blog/?p=2284 Ik heb nog even tijd, maar het is bijna weer vakantie, tijd om uren in de auto te zitten om naar je vakantie adres te gaan. De kinderen mogen mee ๐Ÿ˜› , maar alleen als ze niet zeuren onderweg.

Hihi, ik weet zelf dat een vliegreis sneller gaat als je filmpje kan kijken dus dat zal ook gelden voor mijn kinderen!

Dus ik koop via bol Salora DVP7048TWIN – Portable DVD-speler met 2 schermen – 7 inch.
Vooral het ophangsysteem lijkt erg handig.
Maar de belangrijkste reden is dat er een usb poort op zit.
De rest van de beweegreden mag je raden.

Naief dat ik ben ga ik er-van-uit dat het gebruik van usb gemakkelijk is. FF een filmpie overzetten en klaar.
Helaas is dat niet zo. Maar ik was voorbereid (eindelijk eens tijd om dat uit te zoeken) en heb dus net zolang gezocht totdat ik het antwoord vond.

En die heb ik… alleen het is “the hard way“.
Dat betekend dat dit document niet voor iedereen is, of de avontuurlijk papa/mama.

Misschien is het gemakkelijker op Windows, maar ik werk op OSX dus sommige dingen worden daardoor alleen wat moeilijker.

Hier wat extra info gehaald over de SALORA DVP7048TWIN en hier wat info specifiek over media-ondersteuning.

USB-stick

Officieel is de maximaal ondersteunde capaciteit van de USB poort en SD kaartlezer 2GB, maar in de meeste gevallen zal een USB stick of SD geheugenkaart van een groter formaat probleemloos worden gelezen. Voorwaarde is wel, dat het de USB stick en/of SD geheugenkaart FAT32 geformatteerd is.

Je hebt een usb nodig die naar 2 GB mag zijn??? Ik heb ergens anders gelezen maximum 32.. Ik zelf heb twee sticks van 8GB en die doen het prima.

Niet vergeten die usb sticks opnieuw te formateren (backup die stick, want na formateren staat er niets meer op).
Open “Disk Utility” > wijs de juiste usb stick aan > klik “Erase” button > Select Format: “MS-DOS (FAT)” > Erase …

Klaar met die usb stick, nu het moeilijke deel.

Converteren video

Weer meer info uit de documentatie:

Derhalve adviseren wij voor een juiste weergave van AVI bestanden de volgende parameters:

Formaat: avi
Videocodec: xvid
Audiocodec: mp3
Resolutie: 720ร—405

Voor MP4 geldt:

Formaat: mp4
Videocodec: MPEG4
Audiocodec: mp3
Resolutie: 720ร—405

En wat voor programma’s je kunt gebruiken hiervoor:

Voor het controleren van de bestanden zijn vele (gratis) programmaโ€™s op internet te vinden, zoals het populaire Handbrake of het uiterst gebruiksvriendelijke Freemake Video Converter. Met deze programmaโ€™s kunt u bovendien het bestand omzetten naar een ondersteund formaat.

Voor OSX kan je Handbrake gebruiken, maar naar vele pogingen ben ik daarmee gestopt.
Om 1-of-ander manier krijg ik niet de juiste instellingen.
Wat vooral in de weg zit, is dat gekke formaat van 720×405 pixels. Handbrake kan waarschijnlijk wel croppen, maar telkens was het “verkeerde video resolutie” of “verkeerde videocodec”.

De videocodec die aangegeven wordt is blijkbaar ook een oude standaard en nu word voornamelijk “H.264” gebruikt ipv “MPEG-4”.

Uiteindelijke lukte het me via ffmpeg, een “A complete, cross-platform solution to record, convert and stream audio and video.”

Dit werkt via de terminal, dus niet echt voor beginners (vandaar dat dit document ook “the hard way” in de title heeft).

Install ffmpeg (ik heb dat gedaan via brew, maar er is een installer op de website) en controleer via de terminal

ffmpeg

Ik ga dit in kleine stapjes doen zodat je ongeveer weet wat er gebeurd:

Ga via de terminal naar de juiste folder waar de video staat:

cd pad/naar/video/folder

en type:

ffmpeg -i big_buck_bunny.avi -s 720x405 output_file.mp4

Nu heb je een werkende versie als je video ook 720 pixels was… maar dit werkt dus niet altijd
-i big_buck_bunny.avi is de naam van de videofile
-s 720x405 is de schaal van het beeld
output_file.mp4 is de naam van de nieuwe videofile

ffmpeg -i big_buck_bunny.avi -s 720x405 -vcodec mpeg4 -acodec mp3 output_file.mp4

We geven duidelijk aan welke codec we willen gebruiken
-vcodec mpeg4 voor video mpeg4 (kan ook -c:v mpeg4 geschreven worden)
-acodec mp3 voor audio mp3 (kan ook -c:a mp3 geschreven worden)

ffmpeg -i big_buck_bunny.avi -vf "scale=(iw*sar)*max(720/(iw*sar)\,405/ih):ih*max(720/(iw*sar)\,405/ih), crop=720:405" -vcodec mpeg4 -acodec mp3 output_file.mp4

Hier maken we videos die de juiste afmeting hebben, ook als je niet begint met 720 breed.

-vf "scale=(iw*sar)*max(720/(iw*sar)\,405/ih):ih*max(720/(iw*sar)\,405/ih), crop=720:405" verschaling, ik heb het ook maar ergens vandaan gekopieerd.

ffmpeg -i big_buck_bunny.avi -vf "scale=(iw*sar)*max(720/(iw*sar)\,405/ih):ih*max(720/(iw*sar)\,405/ih), crop=720:405" -c:v mpeg4 -q:v 8 -c:a mp3 -q:a 4 output_file.mp4

Nu nog de kwaliteit wat omhoog en dan zijn we klaar
-c:v mpeg4 -q:v 7 video kwaliteit is tussen 1 en 31
-c:a mp3 -q:a 4 audio kwaliteit is tussen 0 en 9

Bam en los kunnen we!
Ik heb uiteindelijk een bash script geschreven met alle videos.
De videos zijn dan tussen de 400 en 600 mb, ik kwam uit op 25 videos (a 1.5 uur…).

Tips

Zet t 120 in je ffmpeg command zorgt ervoor dat je maar 120 seconden rendert. Handig om even uit te vogelen welke settings jij wil gebruiken.

Spaties en ‘gekke tekens’ moet je escapen: Gekke naam (2000) wordt dan Gekke\ naam\ \(2000\). Gemakkelijker is het om de file-namen te veranderen. Vervang spatie met “_” of “.” en verwijder gekke tekens.

Zelf tips? gebruik de comments!

Links

https://trac.ffmpeg.org/wiki/Encode/MPEG-4
https://trac.ffmpeg.org/wiki/Encode/MP3
https://trac.ffmpeg.org/wiki/Scaling%20(resizing)%20with%20ffmpeg
https://www.virag.si/2012/01/web-video-encoding-tutorial-with-ffmpeg-0-9/
https://trac.handbrake.fr/wiki/Encoders
General FFmpeg encoding guide

(copy paste ze zelf maar, ik ga op vakantie ๐Ÿ˜€ )

]]>
Haxe logo papertoy http://www.matthijskamstra.nl/blog/2016/01/03/haxe-logo-papertoy/ http://www.matthijskamstra.nl/blog/2016/01/03/haxe-logo-papertoy/#comments Sun, 03 Jan 2016 00:50:37 +0000 http://www.matthijskamstra.nl/blog/?p=2261 I have been working a lot with Haxe lately. Programming, documenting and I started to help with some minor design work like shirts and mugs.

Still stuck there. So what could I “give” for free!

A papertoy

The Haxe logo in 3d. For you to create, you only need a printer, paper, scissor and some glue. Build it and you will have a great conversation starter!

Haxe logo papertoy nr1

haxelogopapertoy_1

I was looking for the easiest way to make the Haxe logo and ended up with this. I looks difficult but there are enough clues for everybody to finish this papertoy. This is my favourite!

Haxe logo papertoy nr2

haxelogopapertoy_2

I like this one. You could print it out on colored/orange paper. It’s an Haxe art object. And it’s a great conversation starter!

Haxe logo papertoy nr3

haxelogopapertoy_3

This seems to be the favourite from the likes I got on this picture! Probably because it’s as close you can get to the original logo. It’s a difficult build. But it’s as close as you can get to the original log in 3d.

Haxe branding guidelines

The papertoys are not following the Haxe brand guides. I needed a text to have a back/front and direction for the papertoy. I can’t place the text outside the papertoy, it would be floating ….

]]>
http://www.matthijskamstra.nl/blog/2016/01/03/haxe-logo-papertoy/feed/ 1
Documenting Haxe and Node.js http://www.matthijskamstra.nl/blog/2015/12/21/documenting-haxe-and-node-js/ Mon, 21 Dec 2015 13:17:44 +0000 http://www.matthijskamstra.nl/blog/?p=2257 There used to be a website that got you started with Haxe and Node.js (it was really old, when Haxe was spelled “haXe”).

But that website is no more. So I decided to get some of that back. Based upon the information from the old site and my own need to document this.

How will this help me?

It will get you started with JavaScript/Node.js and Haxe. How to setup your project, install externs and how to work with them. This probably will never be a complete documentation but it will help you get started!

Documentation goals

I wanted to make contributing to this documentation as easy as possible.
That’s why I use Markdown; developers use it, but is really just plain English so everybody can write documentation!
And this documentation hosted on Github, developers favorite place to store code.
Even if you are not a developer and/or don’t want to clone everything, you still can modify the files on the website (you need account to login in and change the .md files).

HAXENODE

Go visit http://matthijskamstra.github.io/haxenode/, and let me know what you think of it

preview:

]]>
Documenting Haxe and Javascript http://www.matthijskamstra.nl/blog/2015/08/31/documenting-haxe-and-javascript/ Mon, 31 Aug 2015 08:14:44 +0000 http://www.matthijskamstra.nl/blog/?p=2239 There used to be a website that got you started with Haxe and js (it was really old, when Haxe was spelled “haXe”).

But that website is no more. I already started with HaxeNode and it seems fitting to also document HaxeJS. So I decided to get some of that back. Based upon the information from the old site and my own need to document this.

How will this help me?

It will get you started with javascript and Haxe. How to setup your project, install externs and how to work with them. This probably will never be a complete documentation but it will help you get started!

Documentation goals

I wanted to make contributing to this documentation as easy as possible.
That’s why I use Markdown; developers use it, but is really just plain English so everybody can write documentation!
And this documentation hosted on Github, developers favorite place to store code.
Even if you are not a developer and/or don’t want to clone everything, you still can modify the files on the website (you need account to login in and change the .md files).

HAXEJS

Go visit http://matthijskamstra.github.io/haxejs/, and let me know what you think of it

preview:

]]>
Scraping with Haxe http://www.matthijskamstra.nl/blog/2015/07/24/scraping-with-haxe/ http://www.matthijskamstra.nl/blog/2015/07/24/scraping-with-haxe/#comments Fri, 24 Jul 2015 08:18:22 +0000 http://www.matthijskamstra.nl/blog/?p=2211 A quick post about something that grabbed my attention quickly.

Scraping

Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites.

Source: https://en.wikipedia.org/wiki/Web_scraping

I already did some research on the subject when I was playing around with my raspberry pi. There is a lot out there, especially for python.

But what about my favourite programming language Haxe?

Again this is a quick search! And this is what I found.

A (very?) old project from Jonas Malaco Filho on github. Check out this code : jonas-haxe and specificly the scraper part of it. Written for Neko, with primarily undocumented classes like neko.vm.Mutex Once you have the html page you can start getting the data from it!

You will need a html/xml parser; I found one written by Yaroslav SivakovHtmlParser haxe library It also can be found on haxelib: http://lib.haxe.org/p/HtmlParser/

I found a little (old) project haxe/php project that I will post as a reference https://github.com/andor44/old_scraper. But then it stops…

Not a field that a lot of haxe-developers walk. Fun!

Update #2

  1. The htmlparser doesn’t work with the html code I am scraping. So I need to focus the parts I want to use. Regular expressions are the way to go, and I suck at them. Luckily I found a online tool that helps with testing the regex: http://www.regexr.com/ from an old flash hero gskinner.
  2. Another thing I ran into, was the data from https sites. You need something “extra” to download html files from there: install hxssl via haxelib haxelib install hxssl and add it to your build.hxml -lib hxssl

Update #1

I am coding this with openfl/regular expressions, but perhaps a better way to-go is node.js! And you can use node.js with Haxe (perhaps not completely ready: hxnodejs but probably good enough for the examples below).

I can’t really say how to start with node.js and Haxe because I have never tried it, but what I have red about it shouldn’t be a big problem. Fun again!

Read this

Some interesting reads… somewhat related to haxe

]]>
http://www.matthijskamstra.nl/blog/2015/07/24/scraping-with-haxe/feed/ 2
Paper shadowbox experiment http://www.matthijskamstra.nl/blog/2015/05/08/paper-shadowbox-experiment/ http://www.matthijskamstra.nl/blog/2015/05/08/paper-shadowbox-experiment/#comments Fri, 08 May 2015 15:58:28 +0000 http://www.matthijskamstra.nl/blog/?p=2168

Okay, better then my previous attempt. But still trying something new #papertoys @OfficialCricut pic.twitter.com/hHXYT965tU

— Matthijs Kamstra (@MatthijsKamstra) May 8, 2015

]]>
http://www.matthijskamstra.nl/blog/2015/05/08/paper-shadowbox-experiment/feed/ 1
Openfl papertoy art project http://www.matthijskamstra.nl/blog/2015/05/04/openfl-papertoy-art-project/ Mon, 04 May 2015 21:48:21 +0000 http://www.matthijskamstra.nl/blog/?p=2169 I love to create projects where you take stuff from the digital world (temporarily, intangible) and drag it into the “real” world. This project is a good example of that. I create a papertoy generated in code and cut by a machine.

Besides filling my blog with new content, I have two other reasons to write this post:

  1. You can use Haxe/Openfl for something else then game-developement! I know I am not the only one, but this group of developers are not as present as the game-defs.
  2. It’s a long and complicated process to get to the end result: it’s difficult to explain this in detail to others, so I wrote down the whole story for interested friend/family/colleagues/fans???

If I ever grow a pair, this post be one of the two talks I would give during wwx2015 just to balance the all tech talks during the event.
But nothing is growing besides my hair, so instead I will write about the process and end-result.

Feedback is always nice, so please don’t hesitate to comment!

Intro

I always say I have two jobs: during the day I am a developer (AS3, javascript, Haxe, Openfl, lately some Java) at Fonk but at night I change into an awesome papertoy engineer (superhero ๐Ÿ˜› ).

The papertoy stuff I do at night, is extremely fun hobby: beside that people download and build my designs I am also featured in some books:

And this post is about both of them; I managed to fuse them together in a Code generated papertoys!

Where did the idea start?

Cricut Explore Family
I while back I got a Cricut Explore from the Cricut company to try out. It’s a nice machine which is extremely good in cutting. Just for the readers that never have build a papertoy, the cutting is the part that you really want to skip… especially if the model is complex. That’s why papertoys are very simple shaped and usually on one page: it’s easy to cut, easy to understand and doable in one hour.

So what makes the Cricut useful? The cutting! So here the idea started to make a papertoy that is complex to cut.

What’s the “brief”?

It’s always a good idea to set some limits in a project, so here are the ones I worked with.
There is a papersize limit that the Cricut can do: it’s around a A3. Yes, vague, I know, but remember the machine isn’t on sale in Europe yet so it’s not on “our” paper-size-system yet.
But eventually I decide to use A4 size paper.
Reason for this:

  • A4 will take less time to print
  • the bigger the papertoy, the heavier the paper needs to be to support itself
  • less intimidating to build

So just one piece of paper, in this case A4 (or letter). It should be easy to build, so not a lots of parts to assemble.
Very quick result during building.

But what I really want: an Art installation: big red button, press it and …
Generate a papertoy, machine cut and presto: an uniquely generated papertoy to build.

Design a papertoy that can be cut by machine

First a papertoy design that is easy to build and fits on one piece of paper:
First papertoy Pixlrr sketch
I decide to call it Pixlrr!

Randomize the papertoy shape

Some ideas just linger in the back of my mind, waiting for a little push/help in the right direction.
Same with this project, I had some ideas how to randomize the shape of the papertoy but all of them didn’t “fit”.
Till I red about an awesome project by Dave Bollinger: pixelspaceshipsAnd it was exactly what I needed!

So to experiment with the idea I build a pixel-sprite-generator-editor, so it was easier to change the design and see the outcome.
Btw the pixel-sprite-generator-editor is opensource at Github.
Flash export of the Pixel Sprite Generator Editor

The pixel-sprite-pattern in which I eventually generated the papertoy is:
Pixlrr pattern
Quick reminder: dark-blue is a border, blue is empty/body and green is body/border. The pattern is mirrored, which creates a nice symmetry.

This is the output (100%) if you export to Neko, yes… small… because it’s done in pixels ๐Ÿ˜€
pixlrr_1430642957000
Okay, a little bigger:
pixlrr_1430642957000
The left part is the body of the papertoy and the right is the mask/face.

Vectorize the pixel image

Pixels are fine if you only have to print the image. I haven’t tried it, but I am not sure it will print the pixels sharp.
I not only want to print it (and keep the image sharp) but I need to feed it to the Cricut Explorer. And it needs vectors to calculate a cutting path.
How to convert this pixel image into something that is scalable?

Funny how some ideas help other ideas: I while back I started (and quickly ended again… ๐Ÿ˜€ ) a blog (blog-engine CyberMonk is also written by me) with patterns I created … with code and exported to .svg.

Currently Scalable Vector Graphics (.svg) are very common for web-development and it’s nice format because it looks like xml.

So I already had a way to create .svg with code!

The rest is not that difficult, eventually you need a bitmap, but from there it’s straight forward:

for (y in 0..._height) {
	for (x in 0..._width) {
		var color : Int = _bitmap.bitmapData.getPixel(x, y);
		// trace ("color: " + StringTools.hex(color,6));
		_colorArray.push  (color);
	}
}

Check: getPixel openfl documentation

Once you have indexed all pixel-colors you generate the svg with a lot of rectangles.
I do some clever things like grouping them, but it’s really is just a lot of rectangles:

<rect id="rectangle_63866_1_" x="160" y="10" fill="#ED264A" width="10" height="10"/>

Let’s be honest

The generation of the papertoys are not entirely automated.
I generate lines for folding and cutting. But I couldn’t get the code to work for the biggest outline used for cutting (all the red en black pixels together). I got it working for simple shapes, but somewhere in my code I end op in a infinity loop. I probably will fix this later (or not).
But to speed up the process, I just united this black/red-“pixels” in Illustrator.

Other part that could be better, but I have little controle over. You need to upload the svg into the editor of Cricut (online). There you need to add it to the canvas, change some of the layers to folding/scorning, “fix” the image (lets say it’s just one click extra you need to do), save the project online and send the data to the machine.
All this means that if I want 100 unique Pixlrr papertoys, I need to have 100 projects online with the changes I just described… It really is not unique, although I can generate the papertoy very easily and in great numbers.

Printing the pattern on the paper (and cutting it) is not impossible, but very labor-intensive. I haven’t even tried it.

Final

header_pixlrr
I am very happy with the end-result. Even when you cut Pixlrr out on plain white paper they look great.
The process of getting to this papertoy was fun. It created 3 new projects on my computer ๐Ÿ˜€ .

Problems! / Solutions?

Okay I know problems are just just problems till they get solved. But these are the ones I ran into.

  1. Printing and Cutting are on two different machines
  2. Folding/scorning of the Cricut is not precise (or deep) enough for my papertoy
  3. Cricut Explorer works only in the cloud
  4. I need to hack the Cricut machine to get access to it by code to really create unique papertoys
  5. The paper need to placed on a sticky cutting mat
  6. Outline the big shape in code

Here my ideas to fix these:

  1. Colored paper works, but I think I will cut up some old comics to make it even more awesome!
  2. I will create a dotted line where I want to fold and cut that way a fold
  3. Bummer, can’t change that unless I change
  4. I have looked into that, but don’t think I want to go that way
  5. Perhaps a laser cutter … but for now not a solution
  6. on my todo list
]]>
navigateToURL for Openfl http://www.matthijskamstra.nl/blog/2015/04/13/navigatetourl-for-openfl/ Mon, 13 Apr 2015 10:18:04 +0000 http://www.matthijskamstra.nl/blog/?p=2165 I have a Flash background.
And I notice that I first think (or Google) what would the code be in Flash and then try to convert it to Haxe/Openfl

Same with:
<a href="open-link-in-new-window" target="_blank">

AS3

var myURL:URLRequest = new URLRequest("open-link-in-new-window");
navigateToURL(myURL, "_blank");

Openfl

var myURL:URLRequest = new URLRequest("open-link-in-new-window");
openfl.Lib.getURL(myURL, "_blank");

]]>
Using svg for assets in Openfl http://www.matthijskamstra.nl/blog/2015/04/09/using-svg-for-assets-in-openfl/ http://www.matthijskamstra.nl/blog/2015/04/09/using-svg-for-assets-in-openfl/#comments Thu, 09 Apr 2015 14:12:01 +0000 http://www.matthijskamstra.nl/blog/?p=2140 I wanted to use svg for icons in an Openfl project.
It’s not intuitive to do this, so I wrote it down for future use.

What are svg files?

Scalable Vector Graphics (SVG) is an XML-based vector image format for two-dimensional graphics with support for interactivity and animation.

Source: http://en.wikipedia.org/wiki/Scalable_Vector_Graphics

Good to remember that they scale awesomely without lost of resolution!

How to add it to your project

You can find the svg code on github.
But you can install it easier with haxelib

Open your terminal and write:

haxelib install svg

To add it to an OpenFL project, add this to your project file:

<haxelib name="svg" />

Code

import openfl.Assets;
import openfl.display.Shape;
import openfl.display.Sprite;
import format.SVG;
 
class SVGExample extends Sprite
{

  public function new()
  {
    var svg : SVG = new SVG(Assets.getText("assets/openfl.svg"));
    var shape : Shape  = new Shape();
    svg.render(shape.graphics);
    addChild(shape);
  }
}

NICE!!!
But now the cool part: it scales without losing resolution

Check the highlighted line for the changes,

import openfl.Assets;
import openfl.display.Shape;
import openfl.display.Sprite;
import format.SVG;
 
class SVGExample extends Sprite
{

  public function new()
  {
    var svg : SVG = new SVG(Assets.getText("assets/openfl.svg"));
    var shape : Shape  = new Shape();
    svg.render(shape.graphics,0,0,1000,1000);
    addChild(shape);
  }
}

for the curious: https://github.com/openfl/svg/blob/master/format/SVG.hx

Sources

  • I remembered this gist, which explains almost everything.
  • Get icons here, they are free for download as long as you credit freepik
  • Featured image from webdesignerdepot
]]>
http://www.matthijskamstra.nl/blog/2015/04/09/using-svg-for-assets-in-openfl/feed/ 2