| fd lastPt nextPt | [Sensor anyButtonPressed] whileFalse. fd _ FormCanvas on: Display. lastPt _ Sensor cursorPoint. [Sensor anyButtonPressed] whileTrue:[ nextPt _ Sensor cursorPoint. nextPt = lastPt ifFalse:[ fd line: lastPt to: nextPt width: 5 color: Color black. lastPt _ nextPt. ]. ].
| fd lastPt nextPt lastPt2 dx dy | [Sensor anyButtonPressed] whileFalse. fd _ FormCanvas on: Display. lastPt _ Sensor cursorPoint. lastPt2 _ lastPt. [Sensor anyButtonPressed] whileTrue:[ nextPt _ Sensor cursorPoint. nextPt = lastPt ifFalse:[ fd line: lastPt to: nextPt width: 5 color: Color random. dx _ (nextPt x - lastPt x) negated . dy _ (nextPt y - lastPt y) . nextPt2 _ lastPt2 + (dx@dy). fd line: lastPt2 to: nextPt2 width: 5 color: Color random. lastPt _ nextPt. lastPt2 _ nextPt2. ]. ].
| fc col fd pts lastPt nextPt minX minY maxX maxY rect fc2 | fc _ FormCanvas extent: Display extent. fc fillColor: Color white. col _ Color random. [Sensor anyButtonPressed] whileFalse. fd _ FormCanvas on: Display. pts _ OrderedCollection new. lastPt _ Sensor cursorPoint. pts add: lastPt. [Sensor anyButtonPressed] whileTrue:[ nextPt _ Sensor cursorPoint. nextPt = lastPt ifFalse:[ fd line: lastPt to: nextPt width: 5 color: col. fc line: (lastPt) to: (nextPt) width: 5 color: col. pts add: nextPt. lastPt _ nextPt. ]. ]. minX _ pts inject: (pts at: 1) x into: [:m :p | m min: p x] . minY _ pts inject: (pts at: 1) y into: [:m :p | m min: p y] . maxX _ pts inject: 0 into: [:m :p | m max: p x] . maxY _ pts inject: 0 into: [:m :p | m max: p y] . rect _ (minX@minY) corner: (maxX@maxY). fc2 _ FormCanvas extent: (maxX - minX) @ (maxY - minY). fc2 _ fc form copy: (rect expandBy: 5). fc2 form setAsBackground.
| fc col fd pts lastPt nextPt minX minY maxX maxY rect fc2 sk | fc _ FormCanvas extent: Display extent. col _ Color random. [Sensor anyButtonPressed] whileFalse. fd _ FormCanvas on: Display. pts _ OrderedCollection new. lastPt _ Sensor cursorPoint. pts add: lastPt. [Sensor anyButtonPressed] whileTrue:[ nextPt _ Sensor cursorPoint. nextPt = lastPt ifFalse:[ fd line: lastPt to: nextPt width: 5 color: col. fc line: (lastPt) to: (nextPt) width: 5 color: col. pts add: nextPt. lastPt _ nextPt. ]. ]. minX _ pts inject: (pts at: 1) x into: [:m :p | m min: p x] . minY _ pts inject: (pts at: 1) y into: [:m :p | m min: p y] . maxX _ pts inject: 0 into: [:m :p | m max: p x] . maxY _ pts inject: 0 into: [:m :p | m max: p y] . rect _ (minX@minY) corner: (maxX@maxY). fc2 _ FormCanvas extent: (maxX - minX) @ (maxY - minY). fc2 _ fc form copy: (rect expandBy: 5). sk _ SketchMorph withForm: fc2 form. sk openInWorld. sk position: (minX@minY) - (5@5).
| fc col fd pts lastPt nextPt minX minY maxX maxY rect fc2 sk angle | fc _ FormCanvas extent: Display extent. col _ Color random. [Sensor anyButtonPressed] whileFalse. fd _ FormCanvas on: Display. pts _ OrderedCollection new. lastPt _ Sensor cursorPoint. pts add: lastPt. [Sensor anyButtonPressed] whileTrue:[ nextPt _ Sensor cursorPoint. nextPt = lastPt ifFalse:[ fd line: lastPt to: nextPt width: 5 color: col. fc line: (lastPt) to: (nextPt) width: 5 color: col. pts add: nextPt. lastPt _ nextPt. ]. ]. minX _ pts inject: (pts at: 1) x into: [:m :p | m min: p x] . minY _ pts inject: (pts at: 1) y into: [:m :p | m min: p y] . maxX _ pts inject: 0 into: [:m :p | m max: p x] . maxY _ pts inject: 0 into: [:m :p | m max: p y] . rect _ (minX@minY) corner: (maxX@maxY). fc2 _ FormCanvas extent: (maxX - minX) @ (maxY - minY). fc2 _ fc form copy: (rect expandBy: 5). sk _ SketchMorph withForm: fc2 form. sk openInWorld. sk position: (minX@minY) - (5@5). [[sk bounds intersects: ActiveWorld bounds] whileTrue: [ (Delay forMilliseconds: 10) wait. angle _ (pts first - pts last) degrees. sk position: sk position + (Point r: 10 degrees: angle). ]. sk delete. ] fork.
| fc col fd pts lastPt nextPt minX minY maxX maxY rect fc2 sk d | fc _ FormCanvas extent: Display extent. col _ Color random. [Sensor anyButtonPressed] whileFalse. fd _ FormCanvas on: Display. pts _ OrderedCollection new. lastPt _ Sensor cursorPoint. pts add: lastPt. [Sensor anyButtonPressed] whileTrue:[ nextPt _ Sensor cursorPoint. nextPt = lastPt ifFalse:[ fd line: lastPt to: nextPt width: 5 color: col. fc line: (lastPt) to: (nextPt) width: 5 color: col. pts add: nextPt. lastPt _ nextPt. ]. ]. minX _ pts inject: (pts at: 1) x into: [:m :p | m min: p x] . minY _ pts inject: (pts at: 1) y into: [:m :p | m min: p y] . maxX _ pts inject: 0 into: [:m :p | m max: p x] . maxY _ pts inject: 0 into: [:m :p | m max: p y] . rect _ (minX@minY) corner: (maxX@maxY). fc2 _ FormCanvas extent: (maxX - minX) @ (maxY - minY). fc2 _ fc form copy: (rect expandBy: 5). sk _ SketchMorph withForm: fc2 form. sk openInWorld. sk position: (minX@minY) - (5@5). d _ (pts last - pts first) abs. [[sk bounds intersects: ActiveWorld bounds] whileTrue: [ (Delay forMilliseconds: 30) wait. d < (50@50) ifTrue: [ sk heading: sk heading + 10] ifFalse: [angle _ (pts first - pts last) degrees. sk position: sk position + (Point r: 10 degrees: angle)]. ]. sk delete ] fork.
下の入力ボックスに書き込んで”add to the page”ボタンで登録出来ます。 修正したい場合はページ左のアイコンの”edit”で出てくる画面で編集可能です。 ページ左のアイコンの”uploads”で画像(JPEG,GIF,PNG)のアップロードもできます。 Link to this Page
|