Can a object do multiple animations but not in the same time

(Mark Hunte) #41

Give me a min…

(Meghana Murthy) #42

sure :blush:

(Meghana Murthy) #43

??? sir @MarkHunte

(Mark Hunte) #44

That was not a literal minute… :roll_eyes:

Looking at your project and living my life…

(Meghana Murthy) #45


(Meghana Murthy) #46

but sir can u help me @MarkHunte

(Mark Hunte) #47


(Meghana Murthy) #48


(Meghana Murthy) #50

??? sir???

(Mark Hunte) #51

First thing.
You can edit your posts in particular the last ones so we do not get a long stream of all amendments…

Please stop pushing for replies. Remember anyone who helps you here is doing so in their own time…

There are no time limits on when we reply or guarantees that we will indeed reply.

Lets use the bedroom as an example.

The bedroom ID is ‘bedroom’ in lower case.
The target timeline is ‘BEDROOM’ in upper case.

an id and a timeline name are both case sensitive.

Meaning when you want a timeline named ‘bedroom’ the timeline name must be ‘bedroom’ and not ‘BEDROOM’

So we need to change the timeline name to a lower case version.

We can do that by going to the Scene inspector.
Double click on the timeline name and rename it.

(I know you are thinking it is easier to just change the ID from ‘bedroom’ to ‘BEDROOM’
It is but IDs normally start in lower case so let stick with convention. )


You removed the timeline controlling the light element so you could target it in Javascript ( not java).

To target it we need to give it an id also.

so we give it the id of ‘bedroomLight’

Note on ids:

IDs are used so we can target specific elements

All elements in hype get an id when ruining in the browser but these are given to them by hype when it loads the project in the browser so we effectively never know what these ids are before hand.

We use the ID field in the inspector to override the auto IDs of an element and give it a known id of our choosing. _
( No two elements must use the same id or that will lead to sleeping with the wrong twin. )

Now all we need to do in the startLight function is add the line

hypeDocument.getElementById(myRoom + 'Light').style.backgroundColor = myColor

We construct the id we are looking for
The color string + the string ‘Light’

Which for purple would come out as


.style.backgroundColor = myColor

is the Javascript way of setting the style attribute background-colour of an element.

(Meghana Murthy) #52

thank you so much :hugs:

(Meghana Murthy) #53

i made it work but . stil confused how to change color name ugh !! this is so confusing. because now it is only working in only one color for all as it coming only white

(Mark Hunte) #54

As I said above your timeline names need to match the ids.

As shown here the timeline bedroom is correct
The others like LIVING ROOM arena CAPS so you need to make them lower case.

Also the id must be the same word.

The living room has the id of living
And the Time line is name LIVING ROOM

We use the id to find the timeline.

The is no timeline named living
So you you need to change the time line name from LIVING ROOM to living
Now the id and time line name matches.


You use elements that you use to show the light colour.
The living room one.

Give this element an id.

This id should include the room id word and another word that we can use to find this element by its id.

So for these elements we use the room id and the word Light

Therefore the living room’s light element’s id should be:

The script I show above will now find the living room light by looking for livingLight

Also change the code line from

document.querySelector('#'+ myRoom + 'Light').style.backgroundColor = myColor


hypeDocument.getElementById(myRoom + 'Light').style.backgroundColor = myColor

That was me after a long day just having a brain fart. Hype can use the style css.

INTERFACE_v3.hype (940.6 KB)

(Meghana Murthy) #55

so i just change the name of the color for it to change color for each room?

(Meghana Murthy) #56

cause it was working for all rooms and colors but it was just coming in one color it wasnt changing color as it was coming only in white

(Meghana Murthy) #57

only for bedroom its changing color the other rooms its staying white i changed all the id and timeline so it matches

(Meghana Murthy) #58

but the colors are not changing for the otehr rooms execept bedroom

(Mark Hunte) #59

It’s id not name. But yes. ( And make sure you do the other changes I mention. )

I am scared to put this but here goes.

Do all of the above. Then look at this bit

One change that may help in the future is that the id of the colour may be purple but you want the colour to be a colour you do not know the name of?.

So we can leave the colour id’s as they are ( i.e with the changes above )

But change the code so that it gets the colour elements background colour and applies that to the light.

This way you can use any colour you want without having to figure out what to put in the light’s id

This is a very simple change to the code.

Instead of getting and using the colours id

var myColor =;

we get it’s background colour.

var myColor = ;

(Meghana Murthy) #60

i changed but i am not sure what is wrong cause the color is still not changing for all the other rooms

(Meghana Murthy) #61 (1.5 MB)

i changed all the ids and change the java script code and whatever changes you told me to do, but i am not sure what is wrong cause the color is still not changing for all the other rooms