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

Bug in property or method error?

New Here ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

Hi, I was following a tutorial and despite everything being correct I got an error several times (this is my first time working with expressions). However, when I renamed the source name, the error disappeared and everything worked correctly. At the end of the tutorial the error reappeared when I wrote the code (the error is in the print screen), but I can't rename the Stroke Width source and the bug precists. Does anyone know how I can get around this? 

 

Captura de ecrã 2022-02-15, às 20.04.16.png

TOPICS
Error or problem , Expressions , How to

Views

383

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 ,
Feb 15, 2022 Feb 15, 2022

Copy link to clipboard

Copied

The slider references don't make any sense. The way they are written "Effects" only makes sense if there is an effect of such name or a pseudo-effect. This is not AE's fault. You're missing something critical about the tutorial or it's simply not explained properly. Find a better tutorial.

 

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
New Here ,
Feb 16, 2022 Feb 16, 2022

Copy link to clipboard

Copied

Thank you for your answer. From what I understood in the tutorial, the ("Effects") and ("Slider") are the references to the Effect Control. The way he explains it makes perfect sense, because these are the Effect Controls that will manipulate the Shape Layer properties. This is a rig for Tapered Stroke with expressions. As I mentioned, everything worked correctly whenever I was allowed to change the source name of the property. So I believe it's a bug. 

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
New Here ,
Feb 16, 2022 Feb 16, 2022

Copy link to clipboard

Copied

And by saying "change the source name of the property" all I did was write the same name again and AE recognized it, and the error was gone.

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
LEGEND ,
Feb 16, 2022 Feb 16, 2022

Copy link to clipboard

Copied

Again - technically the syntax is not correct. Anything beyond that would requzire to know what tutorial you are actually referring to.

 

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
New Here ,
Feb 16, 2022 Feb 16, 2022

Copy link to clipboard

Copied

Yes, I downloaded the tutorial file and the syntax is different. But even with the right syntax, I get the same error. his is the Tutorial link https://www.youtube.com/watch?v=to0WiXD5b9U

Thank you for your answers.

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
Community Expert ,
Feb 16, 2022 Feb 16, 2022

Copy link to clipboard

Copied

The first thing is that is an older tutorial, strokes on shape layers now have a taper property. Yo can probly do everything you want by just draing a line, giving it s stroke and then setting the taper, and trim path properties. You would animate offset in trim path to move the line around.

 

"Effects" is looking for an effect on the current layer called "Stroke Width" are you sure that effect is present on the layer?

Also make sure the names are spelled exactly the same this included capitalization and spacing.

Many problems with code are user errors, typos and stuff like that.

 

If it isn't an error on your part.

The other possibility, may be it is so old it need the extendscript library.

File > Project Settings > Expressions 

Change the engine to Legacy Extendscript.

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
New Here ,
Feb 17, 2022 Feb 17, 2022

Copy link to clipboard

Copied

Thank you for your answer! I'm using an older version because of my OS and already tried to change the engine to Legacy Extendscript without result.

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
Community Expert ,
Feb 17, 2022 Feb 17, 2022

Copy link to clipboard

Copied

As @Mylenium already said, the error here is with the expression syntax, this isn't a bug. Having the word "Effects" in quotes means the expression is looking for an effect called "Effects." If you rewrite that code to simply say 

var strokeWidth = effect("Stroke Width")("Slider");

 

then the issue will go away and you'll be able to change the "Stroke Width" slider name. You can also remove the code and simply pick whip directly to the "Stroke Width" slider. Then you'll see the name reference update in the Expression Editor when you rename the effect. You can (and should) use the JavaScript Expression Engine here, since nothing relies on the Legacy engine. But also, as @thepixelsmith, mentioned, there's no need to build a rig like this anymore since Taper is finally a native feature of strokes. This means you can remove the other 19 shape instances, tons of expression, and lots of clutter in your timeline for a faster and simpler setup.

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
Community Expert ,
Feb 18, 2022 Feb 18, 2022

Copy link to clipboard

Copied

LATEST

Try this expression for Stroke Width:

strokeWidth = effect("Stroke Width")("Slider");
taperOut = effect("Taper Out")("Slider");
groupIndex = thisProperty.propertyGroup(3).propertyIndex;
totalGroups = thisLayer("Contents")("Duplicate Groups")("Contents").numProperties;
strokeTaper = strokeWidth / totalGroups * (totalGroups / groupIndex);

easeIn(taperOut, 0, 100, strokeWidth, strokeTaper);

 I don't use var because it is redundant. 

 

The code should work as long as you have Effects Control Sliders named "Stroke Width" and "Taper Out" on the shape layer.

 

The tutorial is a little long-winded, and unfortunately, the author uses a paid 3rd party script to help write the expressions, so users that have not purchased the same tool don't see what is on the screen, 

 

The tutorial is not exactly how I approach the problem of creating a tapered stroke. It's a little clunky, but it should work. The workflow is viable if you cannot update to a version of AE that offers Tapered Strokes.

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