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

Add mask to video for speaking avatar? #32

Open
voladelta opened this issue Oct 29, 2024 · 6 comments
Open

Add mask to video for speaking avatar? #32

voladelta opened this issue Oct 29, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@voladelta
Copy link

Is there a way to shape/crop video into any size and shape?

For example: A 16:9 video can be shaped into 1:1 or crop center in 9:16 box, or a circle?

@k9p5 k9p5 added the enhancement New feature or request label Oct 29, 2024
@k9p5 k9p5 added this to Core dev Oct 29, 2024
@k9p5
Copy link
Contributor

k9p5 commented Oct 29, 2024

It's not implemented yet, although it shouldn’t take more than an hour to get done.

@girayk
Copy link
Contributor

girayk commented Oct 29, 2024

It's not implemented yet, although it shouldn’t take more than an hour to get done.

So how about you spend that hour for timeline and i could help for that?

@k9p5
Copy link
Contributor

k9p5 commented Oct 29, 2024

I'm constantly working on the timeline but go ahead, I appreciate any help I can get

@girayk
Copy link
Contributor

girayk commented Oct 29, 2024

I'm constantly working on the timeline but go ahead, I appreciate any help I can get

Exactly please keep going on timeline and i will happy to help , if I can

@girayk
Copy link
Contributor

girayk commented Oct 29, 2024

Screenshot 2024-10-29 at 23 52 22

`
import {Clip, VisualMixin} from "@diffusionstudio/core";
import { Graphics } from "pixi.js";

class CircleMaskProps {
radius?: string;
fill?: string;
position: {
x: number,
y: number,
}
}

export class CircleMask extends VisualMixin(Clip) {

public graphics = new Graphics()
public radius = 50;
public fill = null

public constructor(props: CircleMaskProps = {}) {
    super();

    console.log(this)
    Object.assign(this, props);

    this.graphics.circle(this._position.x + this.radius , this._position.y + this.radius , this.radius)
    if (this.fill === null){
        this.graphics.fill({color: '#FFF', alpha: 1});
    }
    else{
        this.graphics.fill({color: this.fill, alpha: this.alpha});

    }
}

}
`

and for the add
let mask = new CircleMask({radius: 360, position: {x: 250, y: 0}}) videoClip.addMask(mask)

write way?

@k9p5
Copy link
Contributor

k9p5 commented Oct 29, 2024

I would implement it exactly the same as the filters and each mask should inherit from graphics. E.g. class CircleMask extends Graphics. Then you can draw the circle in the constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

3 participants