SinterPixels Demos, Part 1: Growing Circles Movie
I have a new app in the App Store: SinterPIxels For the next few weeks, I’ll be writing posts with examples of what SinterPixels can do. Today is the first installment in the series: How to generate this movie:
Note: for some reason there's a gray overlay on the video player which I can't figure out. Here's a link to the generated .mov file
SinterPixels is all about writing a script to generate graphics. So for example, a new circle can be generated with:
make new circle
circles have properties like color, fill color, line width and radius, so these can be specified when you make one like this:
make new circle with properties { color: blue, fill color: clear, line width: 3, radius 20}
That will make a blue circle with no fill color of radius 20 with a line width of 3, If you don’t specify one of the properties, a random one will get used.
To make a circle grow just a little bit, we can get the previous radius and set it to a slightly larger value:
set oldRadius to (get radius of the first circle)
set the radius of the first circle to oldRadius + 1
One of the features of SinterPixels is the ability to record movies. There are custom commands start, record movie frame, and stop that define each frame precisely. When you stop filming, you can specify where to save the file and a filename.
Combining all these in a single script can result in this movie which shows circles growing and disappearing:
Here’s the complete 22 line script to generate this movie:
tell application "SinterPixels"
set theDoc to make new document with properties {width:480, height:320}
start filming of document 1
repeat 30 times
tell document 1
make new circle with properties {line width:4, fill color:clear}
set circleCount to count circles
repeat with c from circleCount to 1 by -1
set oldr to get radius of circle c
set radius of circle c to oldr + 1
set oldlw to line width of circle c
if oldlw is less than 0.5 then
delete circle c
else
set line width of circle c to (oldlw - 0.5)
end if
end repeat
record movie frame duration 2
end tell
end repeat
stop filming of document 1 saving in documents folder filename "Demo.mov"
end tell
For more examples and complete user documentation, see this link: SinterPixels UserDoocs Github