-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
158 lines (135 loc) · 5.66 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='https://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="../stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="../stylesheets/github-light.css" media="screen">
<link rel="stylesheet" type="text/css" href="../stylesheets/print.css" media="print">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<title>demo-0.1.2</title>
<script type="application/javascript" src="../lib/jquery-3.1.1.min.js"></script>
<style type="text/css">
button:hover,
input[type=button]:hover {
background: rgb(9, 147, 240);
}
button:active,
input[type=button]:active {
background: rgb(10, 118, 190);
}
button[disabled],
input[type=button][disabled] {
background: none;
border: 1px solid rgb(187, 181, 181);
color: gray;
text-shadow: none;
}
</style>
</head>
<body>
<header>
<div class="inner">
<h1>Crysyan</h1>
<h2>a web drawing board with canvas</h2>
<a href="https://github.com/BPing/crysyan/tree/v0.1.1" class="button">
<small>View project on</small>
GitHub</a>
</div>
</header>
<div id="content-wrapper">
<div class="inner clearfix">
<section id="main-content">
<h1>
<a id="crysyan" class="anchor" href="#crysyan" aria-hidden="true"><span aria-hidden="true"
class="octicon octicon-link"></span></a>crysyan
</h1>
<p>a web drawing board with canvas</p>
<ul>
<li>1、Record Canvas(video/webM).</li>
<li>2、fUI style upgrade.</li>
</ul>
<a id="download-png" download="my-file-name.png" class="btn btn-github">download png</a>
<button id="start-record">start-record</button>
<button id="stop-record">stop-record</button>
<div style="height:670px;" class="crysyan-designer"></div>
<div id="videoTag" style=" height:600px;" ></div>
</section>
<aside id="sidebar">
<a href="../index.html" class="button">
<small>Home</small>
Home
</a>
<a href="https://github.com/BPing/crysyan/releases/download/crysyan-0.1.2/crysyan-0.1.2.tar.gz" class="button">
<small>Download</small>
0.1.2.tar.gz
</a>
<a href="https://github.com/BPing/crysyan/releases/download/crysyan-0.1.2/crysyan-0.1.2.zip" class="button">
<small>Download</small>
0.1.2.zip
</a>
<a href="https://github.com/BPing/crysyan/blob/gh-pages/demo-0.1.2/index.html" class="button">
<small>Demo Source</small>
Source
</a>
<p class="repo-owner"><a href="https://github.com/BPing/crysyan"></a> is maintained by <a
href="https://github.com/BPing">BPing</a>.</p>
<!--<p>This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the Architect theme by <a href="https://twitter.com/jasonlong">Jason Long</a>.</p>-->
</aside>
</div>
</div>
<script type="application/javascript" src="crysyan/crysyan-designer-min.js"></script>
<script type="application/javascript">
$(".crysyan-designer").CrysyanDesigner({
projectPath: "crysyan/",
isRecord:true,
canvas: {
// px
width: 500,
height: 500
},
toobar: {
length: 500
}
}, function (designer) {
$("#download-png").click(function () {
var canvas = designer.getView().crysyanCanvas;
document.getElementById("download-png").href = canvas.toDataURL();
});
designer.drawBackgroupWithImage("img/pencil.png");
var videoTag=document.getElementById("videoTag");
var videoEle;
var recorder = designer.getCanvasRecorder();
$("#start-record").click(function () {
document.getElementById('start-record').disabled = true;
document.getElementById('stop-record').disabled = false;
document.getElementById('start-record').innerHTML="Recording";
console.log("recording");
if (videoEle instanceof HTMLVideoElement) videoTag.removeChild(videoEle);
recorder.initRecorder();
recorder.startRecording();
});
$("#stop-record").click(function () {
document.getElementById('start-record').disabled = false;
document.getElementById('stop-record').disabled = true;
document.getElementById('start-record').innerHTML="start-record";
console.log("stop");
recorder.stopRecording(function() {
var blob = recorder.getBlob();
videoEle = document.createElement('video');
videoEle.src = URL.createObjectURL(blob);
// videoEle.setAttribute('style', 'height: 100%; position: absolute; top:0; left:0;z-index:9999;width:100%;');
videoTag.appendChild(videoEle);
videoEle.controls = true;
videoEle.play();
});
});
});
//
</script>
</body>
</html>