Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set opacity in text_clip using Lambda #2212

Open
jitendra-koodo opened this issue Aug 9, 2024 · 1 comment
Open

How to set opacity in text_clip using Lambda #2212

jitendra-koodo opened this issue Aug 9, 2024 · 1 comment
Labels
question Questions regarding functionality, usage

Comments

@jitendra-koodo
Copy link

jitendra-koodo commented Aug 9, 2024

text_clip = text_clip.set_opacity(lambda t :   t/duration)

Is there any way to achieve this/make this work to change opacity from 0 to 1? Seems like Lambda is not allowed and I get following error :

File "E:\anaconda3\envs\moviepy\Lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\moviepy\decorators.py", line 99, in add_mask_if_none
    return f(clip, *a, **k)
           ^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\moviepy\decorators.py", line 14, in outplace
    f(newclip, *a, **k)
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\moviepy\video\VideoClip.py", line 672, in set_opacity
    self.mask = self.mask.fl_image(lambda pic: op * pic)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\moviepy\decorators.py", line 14, in outplace
    f(newclip, *a, **k)
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\moviepy\video\VideoClip.py", line 936, in fl_image
    arr = image_func(self.get_frame(0))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\anaconda3\envs\moviepy\Lib\site-packages\moviepy\video\VideoClip.py", line 672, in <lambda>
    self.mask = self.mask.fl_image(lambda pic: op * pic)
                                               ~~~^~~~~
TypeError: unsupported operand type(s) for *: 'function' and 'float'

@jitendra-koodo jitendra-koodo added the question Questions regarding functionality, usage label Aug 9, 2024
@chenbin0522
Copy link

text_clip = text_clip.crossfadein(duration)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions regarding functionality, usage
Projects
None yet
Development

No branches or pull requests

2 participants