A man who murdered his ex-girlfriend and new partner outside the Matalan store where they worked searched the internet for methods of killing in the days before the attack.
Zoe Morgan, 21, and Lee Simmons, 33, were found near the Cardiff central store in Queen Street at about 05:50 BST on 28 September, 2016.
Andrew Saunders, 21, of no fixed abode, admitted their murders in December.
Cardiff Crown Court heard he stabbed Mr Simmons first, then Miss Morgan.
Saunders and Miss Morgan had split up before she and Mr Simmons began a relationship in July 2016.
'I just lost control'
The court heard Saunders approached the couple outside the store as Miss Morgan was waiting to start work.
Witnesses saw him attack Mr Simmons first, stabbing him "four or five" times "in a frenzy" as he pleaded for him to stop.
Mr Simmons called for help and tried to get up but was punched to the floor by Saunders and did not move afterwards.
Miss Morgan tried to help her boyfriend but was pushed away by Saunders, who told her: "I'm coming for you next."
He chased her down the street and eventually caught up with her outside the Boots store where he stabbed her several times.
After the attack, Saunders phoned his mother and told her he had killed the pair. He also sent a text to his father saying "thanks for being a pathetic, useless father. Just killed two people, cheers".
The court heard Saunders returned to his family home and updated his Facebook profile with swear words, and later with the sentence "just a product of society".
Police traced him to the home where he answered the door with a rifle. He was arrested and told officers: "I'm sorry, you know sometimes, you just snap."
He added: "I'm really sorry for what I've done. I just lost control."
He pointed officers to one of the knives used in the attack which he had wrapped in tissue and left in the kitchen. The other had broken in the attack, he said, and he discarded it in Cardiff.
Threats to kill
Philip Bennetts QC, prosecuting, told the court Saunders had been unhappy that his relationship with Miss Morgan had ended and he had made threats against her and Mr Simmons when he found out they were in a relationship.
He contacted her via Facebook, telling her he knew she was "chatting" to someone else, adding: "I will kill whoever it is."
Days after making the threats he searched YouTube for videos including "Top five people who took revenge to a whole new level" and "10 people who got revenge with cheaters".
He also searched for information on how to make a pipe bomb, how to rig a car so it explodes when started, how to illegally buy a gun, and how to inflict knife injuries.
The court heard he then bought two knives, some latex gloves, an air rifle and 500 pellets.
Winston Roddick QC, defending, told the court a doctor who examined Saunders after the attack found he may have been suffering from a "minor" mental illness called an adjustment disorder at the time of the killing.
Mr Roddick said Saunders was in "emotional turmoil" which "must have" had an impact on his behaviour.
In the years before the murders, Saunders was a good student with "excellent grades", Mr Roddick said, and had won a scholarship to play American football at a university in Canada.
But he had been deeply affected by the death of his grandfather and had then struggled to cope with his emotions following his breakup with Miss Morgan, which he said had left him "heartbroken".
Mr Roddick told the court Saunders was genuinely remorseful and wished he could turn the clock back.
The hearing has been adjourned, with sentencing to take place on Tuesday.