Skip to main content

Posts

Showing posts with the label transition2

Falling leaves with Corona SDK and transition2

The latest addition to my transition2 library for Corona is the convenience function fallingLeaf() . I was working on my iOS game  Ice Trap , trying to create a "confetti cannon" effect when the player completes a level and achieves three stars. While playing around with the existing transition functions I managed to reach a quite decent result by combining several different transitions. It took me a while to get there, so I realized that it would probably be nice to turn that combination of transitions into its own convencience function. At its simplest use, you only need a few lines of code to create a leaf that falls smoothly towards the bottom of the screen following a seemingly random pattern: local transition2 = require ( "transition2" ) local leaf = display.newImageRect( "leaf-64px.png" , 64 , 64 ) leaf.x, leaf.y = display.contentCenterX, 0 transition2.fallingLeaf(leaf, {}) Simplest possible use of fallingLeaf() Ok, so that l...

transition2.zRotate(): Rotate Corona display objects in the z dimension

I just added another transition function called zRotate() to my transition2 library for Corona. You guessed it, it rotates a display object in the z dimension around either the x or y axis. It requires the display object to have a path with four nodes (x1, y1) to (x4, y4), like images and rects do. If you want to know more about what transition2 is, you can read this blog post . A simple vertical rotation could look like this: transition.zRotate(coronaLogo, { degrees = 360 , time = 3000 , iterations = 0 , transition = easing.inOutSine, reverse = true , }) A little more complex example of a horizontal rotation with a color effect at the end of each iteration. Note that this example utilizes two new params: iterationDelay and onIterationComplete (which is not the same as onRepeat). transition.zRotate(coronaLogo, { degrees = - 1440 , time = 4000 , iterations = 0 , transition = easing.inOutQuad, perspective = 0.75 , ...

transition2: Extending Corona's transition library with custom transitions

Corona Labs has a great transition library that makes it very easy to perform some useful and common transitions on display objects, such as moving, scaling and rotating them. There are also plenty of different easing algorithms to choose from that affect the behavior of the transition effects. I've used this library a lot and I really like its ease of use. But there are certain things that you can't do with the transition library. One of them is to modify the fill and stroke colors of a display object to be able to fade smoothly from one color into another. UPDATE June 30, 2017: transition2 is now a full standalone rewrite of Corona's transition library. Not just an extension that wraps the transition library like the remaining text in this post suggests. I needed a color transition effect for  Ice Trap  to make some glowing image borders but had a hard time finding any solution that I felt comfortable in using, so I started rolling my own. To make a long story s...