Skip to content

Commit

Permalink
update examples for issue #15
Browse files Browse the repository at this point in the history
  • Loading branch information
akevalion committed Oct 30, 2023
1 parent f8e15c5 commit 34e011d
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 32 deletions.
35 changes: 24 additions & 11 deletions src/Roassal-Examples/RSAnimationExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1322,10 +1322,13 @@ RSAnimationExamples >> example20CircleWaves [
| t |
t := frame.
200 + ((a * 8 - (index * 2 * Float pi / 3) + t) cos
* (1 + (a - t) cos / 2 raisedTo: 3) * 32) ].
* (1 + (a - t) cos / 2 raisedTo: 2) * 32) ].
poly
privatePoints: points;
resetPath ] ].
points: points;
resetPath;
resetBBox ].
canvas signalUpdate
].
canvas
when: RSExtentChangedEvent
do: [ canvas camera zoomToFit: canvas extent extent: 500 @ 500 ]
Expand Down Expand Up @@ -1364,6 +1367,7 @@ RSAnimationExamples >> example21Lines [
com add: line.
com translateTo: ang cos @ ang sin * radius * mult.
com matrix rotateByRadians: a.
com extent: radius * 2 asPoint.
com ] ].

soffset := 0.
Expand Down Expand Up @@ -1405,7 +1409,7 @@ RSAnimationExamples >> example21Lines [
pos := (angleSp negated + (s propertyAt: #offset)) cos * 30.
line := s shapes first.
line color: (Color h: s model + hueOffset s: 0.6 v: 1).
line endPoint: 0 @ pos ] ].
line endPoint: 0 @ pos. ] ].
canvas
when: RSExtentChangedEvent
do: [ canvas camera zoomToFit: canvas extent extent: 500 asPoint ]
Expand All @@ -1430,6 +1434,7 @@ RSAnimationExamples >> example22Lines [
canvas addAll: ((0 to: 360 by: 0.5) collect: [ :i |
RSComposite new
model: i;
size: radius asPoint;
add: (RSLine new
border: border;
startPoint: bar negated / 2 @ 0;
Expand All @@ -1445,7 +1450,8 @@ RSAnimationExamples >> example22Lines [
loadIdentity;
translation: radius * (radian cos @ radian sin);
rotateByRadians:
radian + (frame * (radian * step * 0.5) sin * 0.05) ] ].
radian + (frame * (radian * step * 0.5) sin * 0.05).
s resetBBox ] ].
label := RSLabel new
text: 'Pharo';
fontName: 'Brushcrazy DEMO';
Expand Down Expand Up @@ -1501,6 +1507,7 @@ RSAnimationExamples >> example23PerlinNoise [
add: (newcircle value: c1);
add: (newcircle value: c2);
add: (newcircle value: c3);
extent: rec extent;
yourself.
] ).
canvas newAnimation repeat onStepDo: [ :t | | speed |
Expand Down Expand Up @@ -1762,6 +1769,7 @@ RSAnimationExamples >> example26Bezier [
offset: -10;
yourself).
com add: line.
com size: 500.
com ]).
canvas newAnimation repeat onStepDo: [ :t |
theta := theta + 0.0523.
Expand Down Expand Up @@ -1997,6 +2005,7 @@ RSAnimationExamples >> example29Tick [
c nodes first matrix
loadIdentity;
rotateByRadians: t.
c nodes first resetBBox.
s := c nodes first shapes.
(s at: k key) color: Color lightGray.
(s at: k value) color: Color white ] ].
Expand Down Expand Up @@ -2092,11 +2101,11 @@ RSAnimationExamples >> example30Perlin [
]

{ #category : 'examples' }
RSAnimationExamples >> example31RoundRectagles [
RSAnimationExamples >> example31RoundRectangles [
"example inspired in paper.js"

<script:
'self new example31RoundRectagles open setLabel: ''Round Rectangles'''>
'self new example31RoundRectangles open setLabel: ''Round Rectangles'''>
| canvas mouse extent frame scale color |
canvas := RSCanvas new.
extent := 500 @ 500.
Expand Down Expand Up @@ -2129,7 +2138,8 @@ RSAnimationExamples >> example31RoundRectagles [
e matrix
loadIdentity;
translation: pos;
rotateByDegrees: angle ] ].
rotateByDegrees: angle.
e resetBBox ] ].
^ canvas
]

Expand Down Expand Up @@ -2464,7 +2474,9 @@ for Pharo 8 and Pharo 9.'.
c newAnimation
from: 0;
to: (sum value: line);
onStepDo: [ :t | array at: 1 put: t ].
onStepDo: [ :t |
array at: 1 put: t.
line invalidate ].
c newAnimation
duration: 1 second;
when: RSAnimationEndEvent do: [ c add: lbl ] for: self.
Expand All @@ -2477,7 +2489,8 @@ for Pharo 8 and Pharo 9.'.
lbl matrix
loadIdentity;
translation: (pscale scale: t);
scaleBy: t @ 1 ] ].
scaleBy: t @ 1.
lbl resetBBox ] ].
p := title position.
lineAnime
value: line1
Expand All @@ -2499,7 +2512,7 @@ for Pharo 8 and Pharo 9.'.
duration: 1 second;
from: 0;
to: 360;
onStepDo: [ :t | marker betaAngle: t - 90 ].
onStepDo: [ :t | marker betaAngle: t - 90. c lines do: #resetBBox. c invalidate ].
^ c
"TODO add animation to line3 and line4, hide and remove with animation these elements"
]
Expand Down
2 changes: 1 addition & 1 deletion src/Roassal-SVG-Examples/RSSVGAnimationExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ RSSVGAnimationExamples >> example06AnimatedSVG [
c newAnimation repeat
duration: 0.1 seconds;
when: RSAnimationLoopEvent
do: [ :evt | monster rotateByDegrees: 5 ]
do: [ :evt | monster rotateByDegrees: 5. ]
for: self.
c @ RSCanvasController.
^ c
Expand Down
3 changes: 2 additions & 1 deletion src/Roassal-Shapes/RSBoundingShape.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ c @ RSCanvasController.
c open
```
"
matrix rotateByDegrees: angle
matrix rotateByDegrees: angle.
self resetBBox.
]

{ #category : 'matrix' }
Expand Down
13 changes: 7 additions & 6 deletions src/Roassal-TreeMap-Examples/RSCircularTreeMapExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
Just examples
"
Class {
#name : #RSCircularTreeMapExamples,
#superclass : #RSAbstractExamples,
#category : #'Roassal-TreeMap-Examples'
#name : 'RSCircularTreeMapExamples',
#superclass : 'RSAbstractExamples',
#category : 'Roassal-TreeMap-Examples',
#package : 'Roassal-TreeMap-Examples'
}

{ #category : #examples }
{ #category : 'examples' }
RSCircularTreeMapExamples >> example01Morph [
<script: 'self new example01Morph open'>
| b |
Expand All @@ -16,7 +17,7 @@ RSCircularTreeMapExamples >> example01Morph [
^ b
]

{ #category : #examples }
{ #category : 'examples' }
RSCircularTreeMapExamples >> example02Morph [
<script: 'self new example02Morph open'>
| b palette canvas |
Expand Down Expand Up @@ -57,7 +58,7 @@ RSCircularTreeMapExamples >> example02Morph [
^ canvas
]

{ #category : #examples }
{ #category : 'examples' }
RSCircularTreeMapExamples >> example03Evolving [
"original example created by Alexandre Bergel for Roassal1 ;)"

Expand Down
26 changes: 14 additions & 12 deletions src/Roassal-TreeMap-Examples/RSTreeMapExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
I have examples for RSTreeMap
"
Class {
#name : #RSTreeMapExamples,
#superclass : #RSAbstractExamples,
#category : #'Roassal-TreeMap-Examples'
#name : 'RSTreeMapExamples',
#superclass : 'RSAbstractExamples',
#category : 'Roassal-TreeMap-Examples',
#package : 'Roassal-TreeMap-Examples'
}

{ #category : #examples }
{ #category : 'examples' }
RSTreeMapExamples >> example01Numbers [
<script: 'self new example01Numbers open'>
| b |
Expand All @@ -18,7 +19,7 @@ RSTreeMapExamples >> example01Numbers [
^ b
]

{ #category : #examples }
{ #category : 'examples' }
RSTreeMapExamples >> example02Numbers [
<script: 'self new example02Numbers open'>
| b |
Expand All @@ -37,7 +38,7 @@ RSTreeMapExamples >> example02Numbers [
^ b canvas
]

{ #category : #examples }
{ #category : 'examples' }
RSTreeMapExamples >> example03Labels [
<script: 'self new example03Labels open'>
| b labels |
Expand All @@ -53,7 +54,7 @@ RSTreeMapExamples >> example03Labels [
^ b canvas
]

{ #category : #examples }
{ #category : 'examples' }
RSTreeMapExamples >> example04CollectionSubclasses [
<script: 'self new example04CollectionSubclasses open'>
| b |
Expand All @@ -74,7 +75,7 @@ RSTreeMapExamples >> example04CollectionSubclasses [
^ b canvas
]

{ #category : #examples }
{ #category : 'examples' }
RSTreeMapExamples >> example05FileSystem [
<script: 'self new example05FileSystem open'>
| b color max |
Expand Down Expand Up @@ -102,7 +103,7 @@ RSTreeMapExamples >> example05FileSystem [
^ b canvas
]

{ #category : #examples }
{ #category : 'examples' }
RSTreeMapExamples >> example06FitText [
<script: 'self new example06FitText open'>
| b canvas color |
Expand Down Expand Up @@ -142,9 +143,10 @@ RSTreeMapExamples >> example06FitText [
^ canvas
]

{ #category : #examples }
{ #category : 'examples' }
RSTreeMapExamples >> example07Roassal [
<script: 'self new example07Roassal open'>
<noTest>
| b palette lb bag title |
b := RSTreeMap new.
b inset: 1 asPoint.
Expand All @@ -155,8 +157,8 @@ RSTreeMapExamples >> example07Roassal [
leafWeight: [ :f | f size sqrt ];
explore: (IceRepository registry
detect: [ :each | each name = 'Roassal' ]) location
nesting: [:file | file directories
reject: [ :dir | dir basename beginsWith: '.' ] ]
nesting: [:file |
file directories reject: [ :dir | dir basename beginsWith: '.' ] ]
leaves: #files.
b build.
palette := RSColorPalette qualitative flatui120.
Expand Down
2 changes: 1 addition & 1 deletion src/Roassal-TreeMap-Examples/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #'Roassal-TreeMap-Examples' }
Package { #name : 'Roassal-TreeMap-Examples' }

0 comments on commit 34e011d

Please sign in to comment.