Click on an already clicked object. How to do this?

I have a small rectangle (an icon of an article) that the user can click on to enlarge it (and read it). Then, I want this enlarged rectangle to scale down again on a second click.

When I assign a click on-action to scale it up, and a second click on-action to scale down, it just scales up and immediatley down.

How can I achieve the behaviour that I want.

JavaScript would be one answer, but you might not need to code to solve this problem.

Basically, your timeline would have the following…

  • The beginning
  • The animation of an expanding button
  • the stopping point of the animation (A timeline action pauses the animation)

On the very next frame, just put another timeline action — so the timeline can be played in reverse.

Maybe I’ll make a template of this for the next Free Templates… Free Hype Templates [New “Eclipse” Template] 🌞

Hi Michael,

A free template would be dream, I’m a journalist, not a coder and unexperienced with JavaScript and Hype.
I think about what you described, perhaps I can build it on my own. I didn`t think about timeline actions.

Thanks

Hey, I'm a journalist too! At least, that's what my degree says. HA!

Anyway, the template is done. It should be available on August 16, 2016. That's when it should automatically appear on photics.com.


UPDATE: Here it is... Free Template Tuesday #7 – Tumult Hype “Capitals” – Photics.com

Create an invisible object that pops in front when you click the button. Then set an action for the invisible object that pops it out of the way and shrinks the enlarged item.

I feel I may be stepping on toes here but I would suggest just 1 timeline with an animation of the rectangle growing and shrinking

  1. create a new timeline
  2. animate the rectangle over perhaps 1 sec to enlarge (enough to be able to read) and then shrink.
  3. place a pause at the 15 frame mark (.5 sec) at the end of the enlarge part
  4. Create an action on mouse click that “continues the timeline” so when you first click it plays to the pause and on the second click it continues to the end (the shrink). Remember to tick “can restart timeline” so that it can play from the beginning the next time it is clicked.

enlargeElement.zip (43.6 KB)

2 Likes

There can be more than one solution to a problem. ¯\_(ツ)_/¯

Hi Dbear, I’m getting a error on opening your example file “enlargeElement.zip” - Beta 3.5.2 (258) has expired.

Is it because the “template” is trying to open a copy of the beta on your machine. Seems weird

Here is a copy that isn’t a template to try

enlargeElement.hype.zip (38.1 KB)

That is strange, I dragged and dropped the template on Hype’s application icon and it opens without issue. I had to change it in the “Get Info Window” as it was defaulting to Hype 3.5.2

files of that “type” maybe setup to open using the Beta copy. If you right click the file and see what is says next to “Open with”.

You can change this behaviour by seeing the files information (⌘i) and looking down to Open with. and choosing the right application to open that file type with. (you can choose change all too)

scratch that … just saw your update :slight_smile:

1 Like

Thanks to all for the help. I have to figure out what works for me.