Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
MAC_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
오윤석
2021-04-30 23:26:37 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b3d408199db69f734fbc7a820511b772d7bd3eb8
b3d40819
1 parent
9d46b887
애니메이션 생성
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
gif-generator/src/index.js
gif-generator/src/index.js
View file @
b3d4081
...
...
@@ -34,17 +34,38 @@ class GifGenerator {
fabricObjs
.
map
((
fabricObj
)
=>
{
if
(
fabricObj
instanceof
fabric
.
Path
)
{
objs
.
push
(
new
Component
.
Brush
(
fabricObj
));
this
.
canvas
.
remove
(
fabricObj
);
}
else
if
(
fabricObj
.
text
!==
undefined
)
{
objs
.
push
(
new
Component
.
Text
(
fabricObj
));
this
.
canvas
.
remove
(
fabricObj
);
}
});
objs
.
map
((
obj
)
=>
{
while
(
!
obj
.
end
())
{
console
.
log
(
obj
.
getCurrentFabricObject
());
if
(
objs
.
length
>
0
)
{
let
objIdx
=
0
;
let
isAddMode
=
true
;
const
draw
=
()
=>
{
const
obj
=
objs
[
objIdx
];
if
(
isAddMode
)
{
const
fabricObj
=
obj
.
getCurrentFabricObject
();
obj
.
next
();
if
(
obj
.
end
())
{
if
(
objIdx
<
objs
.
length
-
1
)
objIdx
++
;
else
this
.
canvas
.
off
(
"after:render"
,
draw
);
}
else
{
isAddMode
=
false
;
}
this
.
canvas
.
add
(
fabricObj
);
}
else
{
this
.
canvas
.
remove
(
this
.
canvas
.
_objects
[
this
.
canvas
.
_objects
.
length
-
1
]
);
isAddMode
=
true
;
}
};
this
.
canvas
.
on
(
"after:render"
,
draw
);
draw
();
}
});
console
.
log
(
objs
);
}
...
...
Please
register
or
login
to post a comment