Scaling X

Tagged: ,

This topic contains 7 replies, has 2 voices, and was last updated by  Mark 2 months, 2 weeks ago.

  • September 19, 2016 at 11:55 pm #155979

    I’m trying to just scale X. I have a sprite node that I want to “squish” by a factor then bounce back in an interval of time. I can’t use the ResizeToHeight action in the timeline window because the action happens after a button is pressed.

    I tried ScaleDown but that scales both X and Y.

    And ScaleXDown is only for the mask.

    Anyone have an idea? I could create some code but I thought the kit would have this feature.

    Mark

  • September 20, 2016 at 8:59 am #155985

    You probably want to animate it right? You can actually run any timeline based action by pressing a button (or some other event). Here’s a big page of options…

    Controlling SKActions from the Property List – Story Tellers iOS Starter Kit Documentation

    Let me know if that does the trick. I think a simple non-animated scaleX option is in there somewhere but if not its definitely easy to add.

    Thanks

    • September 20, 2016 at 11:26 am #155988

      No. I just want to scale X (or Y), not animate.

      Mark

    • September 20, 2016 at 12:15 pm #155996

      Gotcha. Found it, you just set the EventName to X or Y. I knew that was in there somewhere (if you’re curious, search “X” in Element.swift)

      How are you triggering the event though?

    • September 20, 2016 at 1:26 pm #155997

      A button is pressed and a rocket lifts off. I just wanted to give the rocket a little negative factor on the X so it gets a little squished and then back to normal. Kind of like showing a little power and force when taking off.

      I tried the “X” setting but that only moves the node. And I would need to have a duration.

  • September 20, 2016 at 1:32 pm #155998

    I shoot, I totally spaced that. Duh. X is just for x =) But if you need to have a duration, you definitely want to use an Action (so it would be an animation after all)

  • September 20, 2016 at 1:36 pm #155999

    So there’s some examples in the Actions folder of already-named actions (like MoveUpAndDown). You can create the animated squish on anything you want just to test out the effect live, then select the actions you made in the timeline, right click and use Convert to Reference. Enter a name for it, and that will be used later when setting the properties for it.

    For an example, search MoveUpAndDown in the demo kit’s property list.

    • September 20, 2016 at 2:51 pm #156002

      Ha! Got it!

      I created the Resize action in the timeline (had to make X on the sprite node 0 – or else X would be resized positive and negative).

      Wow, creating a reference file for actions is great! Opens up many possibilities.

      Thanks,

      Mark

You must be logged in to reply to this topic.