• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Error in this scale syntax - after 2021

New Here ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

 

s = [];
ps = parent.transform.scale.value;
for (i = 0; i < ps.length; i++){
s[i] = value[i]*100/ps[i];
}
s

TOPICS
Expressions

Views

204

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

Properties have a default value. Defining s=[] is therefore utterly nonsensical. Likewise, s[i] does not make any sense within your loop. and finally, of course scale is a 2D prooperty, so yopur final line would have to be [s,s] or something like that. Start by actually reading up on how expressions work instead of just reusing someone else's code that you don't understand.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Apr 08, 2021 Apr 08, 2021

Copy link to clipboard

Copied

LATEST

It seems you would like to build an array. In JavaScript you do such a thing with push():

 

arr = ["Foo", "Bar"]

arr.push("Hello World")

>> arr

>> ["Foo", "Bar", "Hello World"]

 

Try:

    val = value[i]*100 / ps[i];

    s.push(val);

 

*Martin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines